import Dao.UserDaoImpl;
import factory.UserDaoFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class AppForInstanceUser {
    public static void main(String[] args) {
        //原始
//        UserDaoFactory userDaoFactory = new UserDaoFactory();
//        UserDaoImpl userDao = userDaoFactory.getUserDao();
//        userDao.save();
        //方法三
//        ApplicationContext ctx=new ClassPathXmlApplicationContext("application.xml");
//        UserDaoImpl userFactory = ctx.getBean("userDao", UserDaoImpl.class);
//        userFactory.save();
//        方法四
        ApplicationContext ctx = new ClassPathXmlApplicationContext("application.xml");
        UserDaoImpl userFactory = ctx.getBean("userDao", UserDaoImpl.class);
        userFactory.save();
    }
}
